feat: expose table name in schema props #741
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The typed
Table
definition syntax does not require a parameter for the table name when instantiating. The table name is usually specified as the key in theSchema
constructor.We typically set the table name on the
Table
instances when theSchema
is used internally.We currently do expose the
Table
instances on aSchema
viaschema.props
- however theseTable
instances don't have their table name set.The change here is to populate the table name early during construction. Allowing code like
schema.props.user.name
to function correctly.